package com.Ivy.thread.test;

import com.Ivy.thread.object.Consumer;
import com.Ivy.thread.object.Producer;
import com.Ivy.thread.object.Warehouse;

import java.util.Scanner;

public class testDriver {
    public static void main(String[] args) {
        Warehouse wh=new Warehouse();
        Producer pro=new Producer(wh);
        Consumer con=new Consumer(wh);
        pro.start();
        con.start();
        System.out.println("如果需要停止程序，请输入t");
        Scanner sc=new Scanner(System.in);
        String strStopping=sc.next();
        //判断输入是否为Y，如果是y，则将终止变量赋值为true
        if(strStopping.trim().equalsIgnoreCase("t")){
            pro.setStopping(true);
            con.setStopping(true);
            System.out.println("产品已过时，不再出售！");
        }


    }
}
